<?php
	header("Content-type: application/x-javascript");
?>

Ext.define('AmpleHarvest.Data.Store.statistics.data.cErrorSummary',
{
	extend					: 'Ext.data.Store',
	requires				:
	[
		'AmpleHarvest.util.UrlBuilder'
	],
	model					: 'AmpleHarvest.Data.Model.statistics.data.cErrorSummary',
	remoteSort				: true,

	// Set pageSize for store to change from default limit of 25
	pageSize				: 35,

	sorters					:
	{
		property	: 'date',
		direction	: 'DESC'
	},

	constructor				: function(config)
	{
		this.proxy =
		{
			type			: 'ajax',
			url				: AmpleHarvest.util.UrlBuilder.getErrorSummaryUrl(),
			timeout			: '300000',
			method			: 'GET',
			startParam		: 'offset',
			reader			:
			{
				type			: 'json',
				root			: 'collection',
				totalProperty	: 'totalCount'
			},
			simpleSortMode	: true,
			afterRequest	: function(request, success)
			{
				if (success)
				{
					this.lastRequest = request.params;
				}
			},
			lastRequest		: {},
			extraParams		:
			{
				month	: '0',
				view	: 'TOTDAY'
			}
		};

		this.callParent(arguments);
	},

	getLastRequest			: function()
	{
		return this.proxy.lastRequest;
	},

	getLastRequestNoLimit	: function()
	{
		var noLimitParams = Ext.clone(this.proxy.lastRequest);
		Ext.destroyMembers(noLimitParams, 'start', 'limit');

		return noLimitParams;
	}
}
);